import 'package:flutter/material.dart';
import 'package:get/get.dart';

class Header extends StatelessWidget {
  final bool showLeft;
  final bool showRight;
  final String middleText;
  final double middleSize;
  final String rightText;
  final double rightSize;
  final VoidCallback? rightCallBack;

  const Header({
    super.key,
    required this.showLeft,
    required this.middleText,
    this.middleSize=14,
    required this.rightText,
    this.rightSize=12,
    required this.showRight,
    this.rightCallBack,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: 40,
      color: Colors.blue,
      child: Stack(
        alignment: Alignment.center,
        children: [
          if (showLeft)
            Positioned(
              left: 10,
              child: GestureDetector(
                child: Icon(Icons.arrow_back, color: Colors.white),
                onTap: () => Get.back(),
              ),
            ),
          Positioned(
            child: Text(
              middleText,
              style: TextStyle(
                fontSize: middleSize,
                color: Colors.white,
                decoration: null,
              ),
            ),
          ),
          if (showRight)
            Positioned(
              right: 15,
              child: GestureDetector(
                onTap: rightCallBack,
                child: Text(rightText,style: TextStyle(fontSize: rightSize,color: Colors.white)),
              ),
            ),
        ],
      ),
    );
  }
}
